#include <stdio.h>
#include <time.h>

// 统计程序执行的时间

int fn(){
    int sum = 0;
    for(int i = 0; i < 5000000; i++){
        sum = 0;
        for(int j = 1; j <= 100; j++){
            sum += j;
        }
    }
    return sum;
}

int main(){
    time_t start_t, end_t;
    time_t diff_t;

    time(&start_t);
    fn();
    time(&end_t);

    diff_t = difftime(end_t, start_t);
    printf("执行fn()函数耗用了%ld秒\n", diff_t);

    return 0;
}